<template>
  <div id="login-body">
    <div class="backg"></div>
    <div class="login-left">
      <!-- <div class="loginimg img1"><img src="../assets/05.png" /></div>
      <div class="loginimg img2"><img src="../assets/03.png" /></div>
      <div class="loginimg img3"><img src="../assets/04.png" /></div> -->
    </div>
    <el-form :model="ruleForm2" :rules="rules2" ref="ruleForm2" label-position="left" label-width="0px" class="demo-ruleForm login-container">
  
      <!-- <div class="logo"><img src="../assets/logo.png" /></div> -->
      <div class="title">XXX</div>
      <el-form-item prop="account">
  
        <el-input type="text" @keyup.enter.native="handleSubmit2(ev)" v-model="ruleForm2.account" auto-complete="off" placeholder="账号">
          <template slot="prepend">
            <!-- <div id="talkbubble"> <span class="user-img"><img src="../assets/user.svg" /></span></div> -->
          </template>
        </el-input>
      </el-form-item>
      <el-form-item prop="checkPass">
        <el-input type="password" @keyup.enter.native="handleSubmit2(ev)" v-model="ruleForm2.checkPass" auto-complete="off" placeholder="密码">
          <template slot="prepend">
            <!-- <div id="talkbubble"> <span class="user-img"><img src="../assets/pasd.svg" /></span></div> -->
          </template>
        </el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" style="width:100%;" @click.native.prevent="handleSubmit2" :loading="logining">登录</el-button>
        <!--<el-button @click.native.prevent="handleReset2">重置</el-button>-->
      </el-form-item>
  
    </el-form>
    <div class="login-right">
      <!-- <div class="loginimg img4"><img src="../assets/02.png" /></div>
      <div class="loginimg img5"><img src="../assets/06.png" /></div>
      <div class="loginimg img6"><img src="../assets/01.png" /></div> -->
    </div>
  </div>
</template>

<script>
// import { requestLogin } from '../api/api';
export default {
  data() {
    return {
      logining: false,
      ruleForm2: {
        account: '',
        checkPass: ''
      },
      rules2: {
        account: [
          { required: true, message: '请输入账号', trigger: 'blur' }
          // { validator: validaePass }
        ],
        checkPass: [
          { required: true, message: '请输入密码', trigger: 'blur' }
          // { validator: validaePass2 }
        ]
      },
      checked: true
    };
  },
  methods: {
    handleReset2() {
      this.$refs.ruleForm2.resetFields();
    },
    handleSubmit2(ev) {
      // var _this = this;
      this.$refs.ruleForm2.validate((valid) => {
        if (valid) {
          // _this.$router.replace('/table');
          this.logining = true;
          const loginParams = { loginName: this.ruleForm2.account, passWord: this.ruleForm2.checkPass };
          this.$store.dispatch('login_user', {
            self: this,
            obj: loginParams
          }).then(() => {
            this.logining = false;
            this.$notify({
              title: '成功',
              message: '登录成功',
              type: 'success'
            });
          }, () => {
            this.logining = false;
          });
        } else {
          return false;
        }
      });
      // window.sessionStorage.setItem('user', JSON.stringify('12312312'));
      //   this.$router.push({ path: '/StuTrack' });
    }
  }
};

</script>

<style lang="less">
.loginimg {
  position: relative;
  animation: csshub-opacitychange 3s ease-in-out infinite;
  -webkit-animation: csshub-opacitychange 3s ease-in-out infinite;
  @keyframes csshub-opacitychange {
    0%,
    100% {
      opacity: 0.1;
    }

    60% {
      opacity: 1;
    }
  }

  @-webkit-keyframes csshub-opacitychange {
    0%,
    100% {
      opacity: 0.1;
    }

    60% {
      opacity: 1;
    }
  }
}

.img1 {
  left: 170px;
  top: 60px;
}

.img2 {
  left: 0px;
  top: 200px;
}

.img3 {
  left: 170px;
  top: 320px;
}

.img4 {
  left: 55px;
  top: 60px;
}

.img5 {
  left: 230px;
  top: 200px;
}

.img6 {
  left: 40px;
  top: 320px;
}

#login-body {
  width: 1200px;
  height: 800px;
  margin: 4% auto;
  position: relative;
  z-index: 1;
  .login-left {
    float: left;
  }
  .backg {
    // background: url(../assets/dbx.png) no-repeat 100%;
    width: 540px;
    height: 468px;
    position: absolute;
    z-index: -1;
    margin-top: 14%;
    margin-left: 27.7%;
    animation: run 8s linear 0s infinite;
    @keyframes run {
      from {
        -webkit-transform: rotate(0deg);
      }
      to {
        -webkit-transform: rotate(360deg);
      }
    }
  }
}

.login-container {
  /*box-shadow: 0 0px 8px 0 rgba(0, 0, 0, 0.06), 0 1px 0px 0 rgba(0, 0, 0, 0.02);*/
  -webkit-border-radius: 5px;
  border-radius: 5px;
  -moz-border-radius: 5px;
  background-clip: padding-box;
  margin-bottom: 20px;
  // background: url(../assets/dbx2.png) no-repeat;
  width: 507px;
  height: 578px;
  float: left;
  margin-left: 20%;
  margin-top: 10%;
  .logo {
    margin: 0 auto;
    width: 180px;
    padding: 90px 0 20px 0;
  }
  .title {
    margin: 0px auto;
    color: #fff;
    font-size: 20px;
    width: 246px;
    margin-bottom: 25px;
    float: none;
  }
  .el-form-item {
    width: 365px;
    margin: 18px auto;
    .el-input__inner {
      padding: 3px 25px;
      font-size: 14px !important;
      border: none;
    }
    .el-input__inner,
    .el-button {
      height: 54px !important;
      font-size: 20px;
    }
    .el-button {
      font-family: 微软雅黑;
      margin-top: 20px;
      font-weight: bold;
      // background: url(../assets/jianbian.png);
    }
    .el-input-group__prepend {
      background: none !important;
      border: none !important;
      padding: 0;
    }
  }
  #talkbubble {
    width: 50px;
    height: 54px;
    background: #99C9FF;
    position: relative;
    -moz-border-radius: 5px 0 0 5px;
    -webkit-border-radius: 5px 0 0 5px;
    border-radius: 5px 0 0 5px;
    .user-img {
      img {
        width: 23px;
        height: 25px;
        margin: 13px 15px;
      }
    }
  }
  #talkbubble:before {
    content: "";
    position: absolute;
    left: 100%;
    top: 17px;
    width: 0;
    height: 0;
    border-top: 9px solid transparent;
    border-left: 10px solid #99C9FF;
    border-bottom: 10px solid transparent;
  }
}

.login-right {
  overflow: hidden;
  height: 100%;
}

@media screen and (max-width: 1400px) {
  #login-body {
    margin: 0 auto;
    .backg {
      margin-top: 8% !important;
    }
  }
  .login-container {
    margin-top: 4% !important;
  }
  .img1 {
    left: 170px;
    top: 35px;
  }

  .img2 {
    left: 0px;
    top: 140px;
  }

  .img3 {
    left: 170px;
    top: 210px;
  }

  .img4 {
    left: 55px;
    top: 35px;
  }

  .img5 {
    left: 230px;
    top: 140px;
  }

  .img6 {
    left: 40px;
    top: 210px;
  }
}


@media screen and (max-width: 1200px) {}
</style>